package com.nstar.timeline.components
{
	import com.nstar.base.util.ColorUtils;
	import com.nstar.base.util.Logger;
	import com.nstar.base.util.SystemUtils;
	import com.nstar.timeline.events.TimeLineEvent;
	import com.nstar.timeline.vo.TimeLineVO;
	
	import flash.events.MouseEvent;
	
	import mx.containers.Canvas;
	import mx.controls.Image;
	import mx.controls.Text;
	import mx.events.FlexEvent;

	public class EventItem extends Canvas
	{
		private var image:Image;//外部图像链接
		private var title:Text;//标题、加粗、旋转
		private var text:Text;//小标题、正文
		
		private var _timeLineVO:TimeLineVO;
		
		private var logger:Logger = Logger.getInstance();
		
		public function EventItem()
		{
			super();
			this.addEventListener(FlexEvent.CREATION_COMPLETE,init);
		}
		
		private function init(event:FlexEvent):void{
		}
		
		override protected function createChildren():void{
			super.createChildren();
			
		}
		
		
		private function showEditor(event:MouseEvent):void{
			var editor:EventItemEditor = EventItemEditor.show(this._timeLineVO);
			editor.addEventListener("edit",editHandler);
		}
		
		private function editHandler(event:TimeLineEvent):void{
			this._timeLineVO = event.request;
		}
		
		override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void{
			super.updateDisplayList(unscaledWidth,unscaledHeight);
			
		}
		
	
		
		public function set timeLineVO(value:TimeLineVO){
			this._timeLineVO = value;
		}
		
		public function get timeLineVO():TimeLineVO{
			return this._timeLineVO;
		}
		
		public function toXML():String{
			
			return "";
		}
		
		private function toHex(value:uint):String{
			return "0x"+ColorUtils.toHex(value);
		}
	}
}